package com.sinosoft.dsp.component.bpm.util;

import java.util.ArrayList;
import java.util.List;

import javax.faces.model.SelectItem;

import com.sinosoft.dsp.system.core.property.BasePropertyHandler;

/**
 * BPM的状态类型
 * 
 * @author 潘巍（PeterPan）
 * @since 2011-8-7 上午08:37:59
 * 
 */
public enum BpmStatusType {

	// 草稿
	DRAFT("01", BasePropertyHandler.getProperty("bpm.status.draft.title")),
	// 发布
	RELEASE("02", BasePropertyHandler.getProperty("bpm.status.release.title")),
	// 挂起
	HANG("03", BasePropertyHandler.getProperty("bpm.status.hang.title")),
	// 废除
	ABOLISH("04", BasePropertyHandler.getProperty("bpm.status.abolish.title"));

	private static List<SelectItem> statusItems;

	BpmStatusType(String value, String name) {
		this.value = value;
		this.name = name;
	}

	private String value;

	private String name;

	public String getValue() {
		return value;
	}

	public String getName() {
		return name;
	}

	public static List<SelectItem> getStatusItems() {
		if (statusItems == null) {
			statusItems = new ArrayList<SelectItem>();
			for (BpmStatusType st : BpmStatusType.values()) {
				statusItems.add(new SelectItem(st.getValue(), st.getName()));
			}
		}
		return statusItems;
	}

}
